<template>
  <div>
    <!-- 头部 --end-->
    <div class="import">
      <!-- 筛选 --start-->
      <div class="search_container">
        <hy-search
          ref="query"
          class="search_box"
          :searchTitle="searchTitle"
          v-model="searcher"
          :col="6"
          @search="getkaoqinlist(0)"
        ></hy-search>
      </div>
      <!-- 筛选 --end-->
    </div>

    <div id="container">
      <template>
        <el-table :data="tableData" style="width: 100%" height="631" stripe>
          <el-table-column prop="YearInt" label="年份" align="center">
            <template slot-scope="scope">{{scope.row.YearInt}}年</template>
          </el-table-column>
          <el-table-column prop="MonthInt" label="月份" align="center">
            <template slot-scope="scope">{{scope.row.MonthInt}}月</template>
          </el-table-column>
          <el-table-column prop="createOnStr" label="提交时间" align="center"></el-table-column>
          <el-table-column prop="subname" label="提交人" align="center"></el-table-column>
          <el-table-column prop="depart" label="部门" align="center"></el-table-column>
          <el-table-column prop="Total" label="总金额" align="center">
            <template slot-scope="scope">{{scope.row.Total}}元</template>
          </el-table-column>
          <el-table-column prop="state" label="状态" align="center" width="100"></el-table-column>
          <el-table-column label="操作" align="center">
            <el-row slot-scope="scope">
              <el-button
                size="mini"
                type="warning"
                v-show="scope.row.paixu==1"
                @click="checkAttendancexq(scope.row.id,0)"
              >发放</el-button>
              <el-button size="mini" type="primary" @click="checkAttendancexq(scope.row.id,1)">详情</el-button>
            </el-row>
          </el-table-column>
        </el-table>
      </template>
    </div>
    <div class="block">
      <el-pagination
        background
        layout="prev, pager, next"
        :current-page.sync="current"
        :page-size="pagesize"
        @current-change="handleCurrentChange"
        :total="total"
      ></el-pagination>
    </div>
  </div>
</template>
<script>
import axios from "axios";
export default {
  data () {
    return {
      item: null,
      creater: 0,
      dialogVisibles: false,
      total: 1,
      current: 1,
      pagesize: 10,
      bumeng: "",
      searchTitle: [
        {
          type: "input",
          name: "customProductName",
          label: "输入搜索",
          placeholder: "请输入部门",
          prop: "customProductName"
        },
        {
          type: "date2",
          name: "issuanceDate",
          label: "输入时间",
          placeholder: "请选择输入时间",
          prop: "issuanceDate"
        }
      ],
      searcher: {
        customProductName: "",
        customProductNo: "",
        issuanceDate: ""
      },
      tableData: [],
    };
  },
  created () {
    this.creater = JSON.parse(localStorage.getItem("message")).Id;
    this.getkaoqinlist(0);
  },
  methods: {
    //详情
    checkAttendancexq (e, shows) {
      this.$router.push({
        path: "/LssueDetails",
        query: { e: e, shows: shows }
      });
    },
    // 分页
    handleCurrentChange (e) {
      this.getkaoqinlist(e - 1);
    },
    //考勤表列表数据
    getkaoqinlist (page) {
      let start = ""; let end = "";
      if (this.searcher.issuanceDate != null && this.searcher.issuanceDate != "") { start = this.searcher.issuanceDate[0]; end = this.searcher.issuanceDate[1]; }
      let obj = {
        key: this.searcher.customProductName ? this.searcher.customProductName : "",
        start: start,
        end: end,
        pn: page,
        PerPageSize: this.pagesize
      };
      var objs = JSON.stringify(obj);
      let the = { index: 14, jsondata: objs }
      axios.post("/apis/PersonnelMatters.asmx/GetData", the).then(({ data }) => {
        var list = eval('(' + data.d + ')');
        this.total = list.count;
        this.tableData = list.data;
      });
    }
  }
};
</script>
<style lang="scss" scoped>
@import '@/assets/scss/base.scss';
.con {
  display: flex;
}
.nav {
  //border: solid 1px red;
  height: 60px;
  padding: 0 1%;
  position: relative;
  p {
    height: 40px;
    margin: 10px 0;
    line-height: 40px;
    span {
      background: $Header_color;
      color: $Header_color;
    }
  }
  #nav_go1 {
    position: absolute;
    top: 10px;
    right: 1%;
    img {
      height: 16px;
      padding-right: 10px;
    }
  }
}
.upload-demo {
  margin: 0 10px;
}
.import {
  width: 98%;
  height: 80px;
  background: $white;
  position: relative;
  margin: 0 auto;
  .import_buttom {
    border: solid 1px $Personnel;
    height: 60px;
    width: 150px;
    border-radius: 5px;
    color: $Personnel;
    z-index: 999;
    cursor: pointer;
    display: flex;
    position: absolute;
    right: 1%;
    top: 10px;
    img {
      height: 40px;
      margin: 10px auto;
    }
    p {
      width: 60%;
      line-height: 60px;
      font-weight: bold;
      margin: 0 auto;
    }
    input {
      height: 60px;
      width: 150px;
      cursor: pointer;
      position: absolute;
      left: 0;
      opacity: 0; //透明度
    }
  }
  .import_buttom:hover {
    background: $Personnel;
    color: $white;
  }
  .search_container {
    background: $white;
    height: 50px;
    margin-top: 10px;
    width: 98%;
    padding: 0 1%;
    position: absolute;
    .search_box {
      width: 98%;
      padding-top: 5px;
    }
  }
}
#container {
  background: $white;
  width: 98%;
  margin: 10px auto;
  table tr {
    border-top: 1px solid #ebeef5;
    border-bottom: 1px solid #ebeef5;
    text-align: center;
    height: 53px;
    background: $white;
  }
  table tr th {
    text-align: center;
    color: #909399;
    font-size: 14px;
    width: 14%;
  }
  table tr th select {
    height: 30px;
  }

  /////////////////
  table tbody {
    display: block;
    height: 300px;
    overflow-y: scroll;
  }

  table thead,
  tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
    color: #606266;
    font-size: 14px;
  }
  tr:nth-child(even) {
    background-color: #fafafa;
  }
  table thead {
    width: calc(100% - 1em);
  }

  ///////////////////
}
.block {
  margin-top: 10px;

  text-align: center;
}
</style>
<style>
#container .el-select .el-input__inner {
  width: 100%;
  border: none;
  outline: none;
  text-align: center;
}
</style>
